<?
$_tok = new tokkotai;
$res =& $this->results['result'];
$num = count($res);
?>
<fieldset>
	<legend>Results</legend>
	<p>Your search returned <span class="b"><?=$num?></span> revision<? if($num != 1):?>s<? endif;?></p>
<table cellspacing="0" cellpadding="4" class="w100pc">
<?
$i = 0;
while($i < $num):
?>
	<tr>
		<th>Revision</th>
		<td><?=$res[$i]['rev']?></td>
	</tr>
	<tr>
		<th>Date</th>
		<td><?=date('l jS F Y H:i:s',strtotime($res[$i]['date']))?></td>
	</tr>
	<tr>
		<th>User</th>
		<td><?=$res[$i]['user']?></td>
	</tr>
	<tr>
		<th>Log</th>
		<td><?=nl2br(trim($res[$i]['log']))?></td>
	</tr>
	<tr<? if($i != ($num - 1)):?> class="end"<? endif;?>>
		<td></td>
		<td>
		<table cellspacing="0" cellpadding="4">
		<?
		$j = 0;
		$numf = count($this->results['files'][$res[$i]['rev']]);
		while($j < $numf):
			$file =& $this->results['files'][$res[$i]['rev']][$j];
		?>
			<tr class="noend">
				<td><?=$file['action']?></td>
				<td>
					<?=$_tok->parse_path($file['resource'])?>
					<?
					if($_tok->get_file_extension($file['resource'])):
					?>
					[
						<?
						if($file['action'] == 'D'):
						?>
						<a href="view.php?id=<?=$file['id']?>&amp;prev">before</a>
						<?
						endif;
						?>
						<?
						if($file['action'] == 'A'):
						?>
						<a href="view.php?id=<?=$file['id']?>">view</a>
						<?
						endif;
						?>
						<?
						if($file['action'] == 'M'):
						?>
						<a href="view.php?id=<?=$file['id']?>">view</a>
						|
						<a href="view.php?id=<?=$file['id']?>&amp;prev">before</a>
						|
						<a href="diff.php?id=<?=$file['id']?>">diff</a>
						<?
						endif;
						?>
					]
					<?
					elseif($_tok->get_mimetype($file['resource'])):
					?>
						[
						<?
						if($file['action'] == 'D'):
						?>
						<a href="bin.php?id=<?=$file['id']?>&amp;prev">before</a>
						<?
						endif;
						?>
						<?
						if($file['action'] == 'A'):
						?>
						<a href="bin.php?id=<?=$file['id']?>">view</a>
						<?
						endif;
						?>
						<?
						if($file['action'] == 'M'):
						?>
						<a href="bin.php?id=<?=$file['id']?>">view</a>
						|
						<a href="bin.php?id=<?=$file['id']?>&amp;prev">before</a>
						<?
						endif;
						?>
						]
					<?
					endif;
					?>
				</td>
			</tr>
		<?
		++$j;
		endwhile;
		?>
		</table>
		</td>
	</tr>


<?
++$i;
endwhile;
?>
</table>
</fieldset>
